<template name="putawayMoveDocPalletRFInputPage">
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true" backRouterName="putawayMoveDocRFPalletInputPage">
			<block slot="content">按托上架</block>
		</cu-custom>
		<form>
			<view class="cu-form-group animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
				<view class="title">托盘码：</view>{{this.myFormData.palletNo}}
			</view>
			<view class="cu-form-group animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="title">建议上架库位：</view>{{this.myFormData.locationCode}}
			</view>
			<view class="cu-form-group animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
				<view class="title">实际上架库位：</view>
				<input placeholder="请输入实际上架库位" name="input" v-model="myFormData.realToLocation" @confirm="onSubmit"></input>
				<text class="cuIcon-scan" @click="InputFocus"></text>
			</view>
			<view class="padding flex flex-direction">
				<button class="cu-btn bg-blue lg"  @click="onSubmit">确认</button>
			</view>
		</form>
	</view>
</template>

<script>
	import crypto from '@/api/crypto.js' 
	export default {
		data() {
			return {
				myFormData:{
					taskId:'',
					palletNo:'',
					locationCode:'',
					realToLocation:'',
				},
				palletNoConfirmUrl:'/pda/palletNoPutAwayConfirm',
			};
		},
		onLoad: function (option) {
			if(!option.item){
				uni.navigateTo({
					url: '/pages/wms/putawayMoveDocPage'
				});
			}
			const tempItem = JSON.parse(decodeURIComponent(option.item));
			this.myFormData = tempItem 
		},
		methods: {
			onSubmit() {
				if(!this.myFormData.realToLocation || this.myFormData.realToLocation.length == 0){
					this.$tip.error('请扫描上架库位!');
					return;
				}
				uni.navigateTo({
					url: '/pages/wms/asnReceiveRFDetailListPage?item='+ encodeURIComponent(JSON.stringify(this.myFormData))
				});
			},
			InputFocus() {
				 let that = this;
				 // 调起条码扫描
				 uni.scanCode({
					 onlyFromCamera: true,
					 success: function (res) {
						 that.myFormData.realToLocation = res.result
					 }
				 });
			},
		}
	}
</script>

<style>
	.cu-form-group .title {
		min-width: calc(4em + 15px);
	}
</style>